{{!-- 
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--}}
<div class="diff-content">
    <div><b>Policy ID :&nbsp;&nbsp;</b><label class="badge badge-ranger"> {{objectId}}</div>
        <div class="no-margin label-size13-weightbold">Policy Name: {{policyName}}</div>
        <div class="no-margin label-size13-weightbold">Service Name: {{repoName}}</div>
        {{#if zoneName}}
            <div class="no-margin label-size13-weightbold">Zone Name: {{zoneName}}</div>
        {{/if}}
        {{#if repositoryType}}
            <div class="no-margin label-size13-weightbold">Repository Type: {{repositoryType}}</div>
        {{/if}}
        <div class="no-margin label-size13-weightbold">Created Date: {{objectCreatedDate}}</div>
        <div class="no-margin label-size13-weightbold">Created By: {{userName}}</div>
        {{#if collection.length}}
            <h5 class="bold wrap-header m-t-sm">Policy Details:</h5>
            <div class="diff table-responsive">
                <div class="diff-left">
                    <h3>Fields</h3>
                    <ol class="attr">
                        {{#each collection}}
                            <li class="change-row">{{./this.attributes.attributeName}}</li>
                        {{/each}}
                    </ol>
                </div>
                <div class="diff-right">
                    <h3>New Value</h3>
                    <ol class="list-unstyled data">
                        {{#each collection}}
                            {{#compare ./this.attributes.newValue "eq" ''}}
                                <li>--</li>
                            {{else}}
                                <li class="change-row">{{./this.attributes.newValue}}</li>
                            {{/compare}}
                        {{/each}}
                    </ol>
                </div>
            </div>
        {{/if}} 
        {{#if newPolicyValidityPeriod}}
            <h5 class="bold wrap-header m-t-sm">Validity Period:</h5>
            <div class="diff diff-perms" >
                <div class="diff-right diff-list" data-id="diff">
                    <h3>New Value</h3>
                    {{#each newPolicyValidityPeriod}}
                        <ol class="list-unstyled data">
                            <li class="change-row">Start Date:
                                {{#if this.startTime}}
                                    {{this.startTime}}
                                {{else}}
                                    --
                                {{/if}}
                            </li>
                            <li class="change-row">End Date:
                                {{#if this.endTime}}
                                    {{this.endTime}}
                                {{else}}
                                    --
                                {{/if}}
                            </li>
                            <li class="change-row">Time Zone:
                                {{#if this.timeZone}}
                                    {{this.timeZone}}
                                {{else}}
                                    --
                                {{/if}}
                            </li>
                        </ol><br/>
                    {{/each}}
                </div>
            </div>
        {{/if}}
        {{#if newPolicyConditions}}
            <h5 class="bold wrap-header m-t-sm">Policy Conditions:</h5>
            <div class="diff diff-perms" >
                <div class="diff-right diff-list" data-id="diff">
                    <h3>New Value</h3>
                    {{#each newPolicyConditions}}
                        <li class="change-row">
                            {{#if this.type}}
                                {{this.type}}: [{{this.values}}]
                            {{else}}
                                --
                            {{/if}}
                        </li>
                    {{/each}}
                </div>
            </div>
        {{/if}}
        {{#if newPolicyItems}}
            <h5 class="bold wrap-header m-t-sm">Allow PolicyItems:</h5>
            <div class="diff diff-perms" >
                <div class="diff-right diff-list" data-id="diff">
                    <h3>New Value</h3>
                    {{#each newPolicyItems}}
                        <ol class="list-unstyled data">
                            <li class="change-row">Roles:
                                {{#if_eq this.roles compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.roles}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Groups:
                                {{#if_eq this.groups compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.groups}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Users:
                                {{#if_eq this.users compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.users}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Permissions:
                                {{#each this.permissions}}
                                    {{this}} <span>,</span>
                                {{/each}}
                            </li>
                            {{#if this.conditions}}
                            <li class="change-row">
                                Conditions:
                                {{#each this.conditions}}
                                    {{this.type}} : [{{this.values}}]<span>,</span>
                                {{/each}}
                            </li>
                            {{/if}}
                            <li class="change-row">Delegate Admin:{{this.delegateAdmin}}</li>
                        </ol><br/>
                    {{/each}}
                </div>
            </div>
        {{/if}}

        <!-- Allow Exceptions -->

        {{#if newAllowExceptionPolicyItems}}
            <h5 class="bold wrap-header m-t-sm">Allow Exceptions:</h5>
            <div class="diff diff-perms" >
                <div class="diff-right diff-list" data-id="diff">
                    <h3>New Value</h3>
                    {{#each newAllowExceptionPolicyItems}}
                        <ol class="list-unstyled data">
                            <li class="change-row">Roles:
                                {{#if_eq this.roles compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.roles}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Groups:
                                {{#if_eq this.groups compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.groups}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Users:
                                {{#if_eq this.users compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.users}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Permissions:
                                {{#each this.permissions}}
                                    {{this}} <span>,</span>
                                {{/each}}
                            </li>
                            {{#if this.conditions}}
                                <li class="change-row">
                                    Conditions:
                                    {{#each this.conditions}}
                                        {{this.type}} : [{{this.values}}]<span>,</span>
                                    {{/each}}
                                </li>
                            {{/if}}
                            <li class="change-row">Delegate Admin:{{this.delegateAdmin}}</li>
                        </ol><br/>
                    {{/each}}
                </div>
            </div>
        {{/if}}

        <!-- Deny PolicyItems -->

        {{#if newDenyPolicyItems}}
            <h5 class="bold wrap-header m-t-sm">Deny PolicyItems:</h5>
            <div class="diff diff-perms" >
                <div class="diff-right diff-list" data-id="diff">
                    <h3>New Value</h3>
                    {{#each newDenyPolicyItems}}
                        <ol class="list-unstyled data">
                            <li class="change-row">Roles:
                                {{#if_eq this.roles compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.roles}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Groups:
                                {{#if_eq this.groups compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.groups}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Users:
                                {{#if_eq this.users compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.users}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Permissions:
                                {{#each this.permissions}}
                                    {{this}} <span>,</span>
                                {{/each}}
                            </li>
                            {{#if this.conditions}}
                            <li class="change-row">
                                Conditions:
                                {{#each this.conditions}}
                                    {{this.type}}: [{{this.values}}]<span>,</span>
                                {{/each}}
                            </li>
                            {{/if}}
                            <li class="change-row">Delegate Admin:{{this.delegateAdmin}}</li>
                        </ol><br/>
                    {{/each}}
                </div>
            </div>
        {{/if}}
        <!-- Deny Exception PolicyItems -->
        {{#if newDenyExceptionPolicyItems}}
            <h5 class="bold wrap-header m-t-sm">Deny Exception PolicyItems:</h5>
            <div class="diff diff-perms">
                <div class="diff-right diff-list" data-id="diff">
                    <h3>New Value</h3>
                    {{#each newDenyExceptionPolicyItems}}
                        <ol class="list-unstyled data">
                            <li class="change-row">Roles:
                                {{#if_eq this.roles compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.roles}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Groups:
                                {{#if_eq this.groups compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.groups}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Users:
                                {{#if_eq this.users compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.users}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Permissions:
                                {{#each this.permissions}}
                                    {{this}} <span>,</span>
                                {{/each}}
                            </li>
                            {{#if this.conditions}}
                                <li class="change-row">
                                    Conditions:
                                    {{#each this.conditions}}
                                        {{this.type}} : [{{this.values}}]<span>,</span>
                                    {{/each}}
                                </li>
                            {{/if}}
                            <li class="change-row">Delegate Admin:{{this.delegateAdmin}}</li>
                        </ol><br/>
                    {{/each}}
                </div>
            </div>
        {{/if}} 

        <!-- Masking Policy Items -->
        {{#if newMaskPolicyItems}}
            <h5 class="bold wrap-header m-t-sm">Masking Policy Items:</h5>
            <div class="diff diff-perms" >
                <div class="diff-right diff-list" data-id="diff">
                    <h3>New Value</h3>
                    {{#each newMaskPolicyItems}}
                        <ol class="list-unstyled data">
                            <li class="change-row">Roles:
                                {{#if_eq this.roles compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.roles}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Groups:
                                {{#if_eq this.groups compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.groups}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Users:
                                {{#if_eq this.users compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.users}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Accesses:
                                {{#each this.accesses}}
                                    {{this.type}} <span>,</span>
                                {{/each}}
                            </li>
                            {{#if this.dataMaskInfo}}
                                <li class="change-row">
                                    Data Mask Types:
                                    <i>
                                        {{this.dataMaskInfo.dataMaskType}}
                                    </i>
                                </li>
                            {{/if}}
                        </ol><br/>
                    {{/each}}
                </div>
            </div>
        {{/if}}

        <!--  Row Filter Policy Items-->
        {{#if newRowFilterPolicyItems}}
            <h5 class="bold wrap-header m-t-sm">Row Level Filter Policy Items:</h5>
            <div class="diff diff-perms" >
                <div class="diff-right diff-list" data-id="diff">
                    <h3>New Value</h3>
                    {{#each newRowFilterPolicyItems}}
                        <ol class="list-unstyled data">
                            <li class="change-row">Roles:
                                {{#if_eq this.roles compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.roles}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Groups:
                                {{#if_eq this.groups compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.groups}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Users:
                                {{#if_eq this.users compare=0}}
                                    &lt;empty&gt;
                                {{else}}
                                    {{this.users}}
                                {{/if_eq}}
                            </li>
                            <li class="change-row">Accesses:
                                {{#each this.accesses}}
                                    {{this.type}} <span>,</span>
                                {{/each}}
                            </li>
                            {{#if this.rowFilterInfo}}
                                <li class="change-row">
                                    Row Level Filter:
                                    {{this.rowFilterInfo.filterExpr}}
                                </li>
                            {{/if}}
                        </ol><br/>
                    {{/each}}
                </div>
            </div>
        {{/if}}

    </div>